﻿using Microsoft.EntityFrameworkCore.Migrations;

namespace Batman.Jianbei.Forum.Migrations.JianbeiForumDbContext2Migrations
{
    public partial class _201903231 : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InsulinPumpModel_InsulinPump_InsulinPumpId",
                table: "InsulinPumpModel");

            migrationBuilder.DropForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation");

            migrationBuilder.DropColumn(
                name: "IsDeleted",
                table: "InsulinPump");

            migrationBuilder.DropColumn(
                name: "NormalizedName",
                table: "InsulinPump");

            migrationBuilder.RenameColumn(
                name: "InsulinPumpModelId",
                table: "PumpSaleInfomation",
                newName: "PumpModelId");

            migrationBuilder.RenameIndex(
                name: "IX_PumpSaleInfomation_InsulinPumpModelId",
                table: "PumpSaleInfomation",
                newName: "IX_PumpSaleInfomation_PumpModelId");

            migrationBuilder.RenameColumn(
                name: "InsulinPumpId",
                table: "InsulinPumpModel",
                newName: "PumpBrandId");

            migrationBuilder.RenameIndex(
                name: "IX_InsulinPumpModel_InsulinPumpId",
                table: "InsulinPumpModel",
                newName: "IX_InsulinPumpModel_PumpBrandId");

            migrationBuilder.AddForeignKey(
                name: "FK_InsulinPumpModel_InsulinPump_PumpBrandId",
                table: "InsulinPumpModel",
                column: "PumpBrandId",
                principalTable: "InsulinPump",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_PumpModelId",
                table: "PumpSaleInfomation",
                column: "PumpModelId",
                principalTable: "InsulinPumpModel",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_InsulinPumpModel_InsulinPump_PumpBrandId",
                table: "InsulinPumpModel");

            migrationBuilder.DropForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_PumpModelId",
                table: "PumpSaleInfomation");

            migrationBuilder.RenameColumn(
                name: "PumpModelId",
                table: "PumpSaleInfomation",
                newName: "InsulinPumpModelId");

            migrationBuilder.RenameIndex(
                name: "IX_PumpSaleInfomation_PumpModelId",
                table: "PumpSaleInfomation",
                newName: "IX_PumpSaleInfomation_InsulinPumpModelId");

            migrationBuilder.RenameColumn(
                name: "PumpBrandId",
                table: "InsulinPumpModel",
                newName: "InsulinPumpId");

            migrationBuilder.RenameIndex(
                name: "IX_InsulinPumpModel_PumpBrandId",
                table: "InsulinPumpModel",
                newName: "IX_InsulinPumpModel_InsulinPumpId");

            migrationBuilder.AddColumn<bool>(
                name: "IsDeleted",
                table: "InsulinPump",
                nullable: false,
                defaultValue: false);

            migrationBuilder.AddColumn<string>(
                name: "NormalizedName",
                table: "InsulinPump",
                maxLength: 20,
                nullable: false,
                defaultValue: "");

            migrationBuilder.AddForeignKey(
                name: "FK_InsulinPumpModel_InsulinPump_InsulinPumpId",
                table: "InsulinPumpModel",
                column: "InsulinPumpId",
                principalTable: "InsulinPump",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_PumpSaleInfomation_InsulinPumpModel_InsulinPumpModelId",
                table: "PumpSaleInfomation",
                column: "InsulinPumpModelId",
                principalTable: "InsulinPumpModel",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
